package org.guitycrown.Command.NetworkCommand;

import io.airlift.airline.Command;
import io.airlift.airline.Option;
import org.guitycrown.CommandGroup.NetworkGroup.SimpleNetwork;
import org.snmp4j.CommunityTarget;
import org.snmp4j.PDU;
import org.snmp4j.Snmp;
import org.snmp4j.TransportMapping;
import org.snmp4j.event.ResponseEvent;
import org.snmp4j.mp.SnmpConstants;
import org.snmp4j.smi.*;
import org.snmp4j.transport.DefaultUdpTransportMapping;

import java.io.IOException;
import java.util.Vector;

/**
 * Created by kira on 2016/5/29.
 */
@Command(name = "snmpwalk", description = "SNMP Walk")
public class SnmpWalkCommand extends SimpleNetwork implements Runnable {
    private Snmp snmp = null;
    private Address targetAddress = null;

    @Option(name = "-s", description = "target server")
    public String serverIP;

    @Option(name = "-v", description = "snmp version")
    public String version;

    @Option(name = "-c", description = "community name")
    public String community;

    @Option(name = "-o", description = "snmp oids")
    public String oid;


    @Override
    public void run() {
        SnmpGetter snmpGetter = new SnmpGetter(serverIP, community, oid, version);
        try {
            snmpGetter.SentGetSnmp();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
